<%@page import="com.netistate.pojo.Doc"%>
<%@page import="com.netistate.pojo.Project"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>项目下文档</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/default.css" />
    <script type="text/javascript"  src="${pageContext.request.contextPath}/js/jquery-min.js"></script> 
    <script type="text/javascript"  src="${pageContext.request.contextPath}/js/common.js"></script>
    <script type="text/javascript"  src="${pageContext.request.contextPath}/js/table.js"></script>
    <script type="text/javascript"  src="${pageContext.request.contextPath}/plugin/msgbox/msgbox.js"></script>
    <script type="text/javascript"  src="${pageContext.request.contextPath}/jsp/doc/doc.js"></script>
    <script type="text/javascript"  src="${pageContext.request.contextPath}/plugin/calendar/Calendar.js"></script>
    <style type="text/css">
		.overTd {table-layout:fixed}
		.overTd td{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;padding:0px}
    </style>
  </head>
  <body>
  	<% String id = (String)request.getSession().getAttribute("projectid");
   %>
  		
  		<div id="xtab">
			<a id="rightDiv0_tab" href="#" class='homelink' onclick="lookSale(<%=id%>)"><span style="cursor:pointer;">服务记录表</span></a>
			<a id="rightDiv1_tab" href="#" class='homelink' onclick="lookTechNote(<%=id%>)"><span style="cursor: pointer;">技术备忘录</span></a>
			<a id="rightDiv1_tab" href="#" class='homelink' onclick="lookClient(<%=id%>)"><span style="cursor: pointer;">客户信息表</span></a>
			<a id="rightDiv1_tab" href="#" class='homelink curren' onclick=""><span style="cursor: pointer;">文档列表</span></a>
		</div>
  
		<div id="show_doc" style="width:100%;height:95%; overflow-y:scroll; border:1px solid;" >
			<table id="dArticleList" width="100%" border="0" cellpadding="0" cellspacing="1"  class="resizable overTd">
				<thead>
					<tr class="fixHead">
						<td  class="td1" style="cursor:pointer" width="10%">所属项目名称</td>
						<td  class="td1" style="cursor:pointer" width="10%">创建人</td>
						<td  class="td1" style="cursor:pointer" width="10%">所属服务记录名称</td>
						<td  class="td1" style="cursor:pointer" width="10%">文档名称</td>
						<td  class="td1" style="cursor:pointer" width="10%">创建时间</td>
						<td  class="td1" width="10%">下载文档</td>
					</tr>
				</thead>
				<tbody>
					<%
						List<Doc> list = new ArrayList<Doc>();
						List<Doc> docList = (List<Doc>)request.getAttribute("dList");
						if(docList == null){
							list = (List<Doc>)request.getSession().getAttribute("projectDocList");
						}else{
							list = docList;
						}
						for(Doc d : list){
						%>
						<tr onMouseOver= "this.bgColor   =   '#cccccc '; "   onMouseOut= "this.bgColor   =   '#FFFFFF'; " >  
				       		<td title="<%=d.getProject().getProjectName() %>" align="center" class="td2 txbtip" ><%=d.getProject().getProjectName() %></td>
				       		<td title="<%=d.getCreater() %>" align="center" class="td2 txbtip" ><%=d.getCreater() %></td>
				       		<td title="<%=d.getProjectServices().getServiceName()%>" align="center" class="td2 txbtip" ><%=d.getProjectServices().getServiceName() %></td>
				       		<td title="<%=d.getDocName() %>" align="center" class="td2 txbtip" ><%=d.getDocName() %></td>
				       		<td title="<%=d.getCreatetime() %>" align="center" class="td2 txbtip" ><%=d.getCreatetime() %></td>
				       		<td title="" align="center" class="td2 txbtip" >
				       			<a href="downDoc.action?docid=<%=d.getId() %>" class='buttonlink txbtip' style="display:inline" title='下载文档' >
				       			<%  String extName = d.getDocName().substring(d.getDocName().lastIndexOf(".")+1);
		       						if("xls".equals(extName) || "xlsx".equals(extName)){ %>
		       						<img width='16' height='16' src='${pageContext.request.contextPath}/images/common/excel.png'/>
		       					<%	}else if("doc".equals(extName) || "docx".equals(extName)){ %>
		       						<img width='16' height='16' src='${pageContext.request.contextPath}/images/common/word.png'/>
		       					<%	}else{ %>
		       						<img width='16' height='16' src='${pageContext.request.contextPath}/images/common/down.png'/>
		       					<%	} %>
			       				</a>
				       		</td>
						</tr>	
					  <%}%>	
				</tbody>
			</table>
		</div>
  </body>
  
  <script type="text/javascript">
  		
  		
  		
  
  
  		//切换项目下的技术备忘录
		function lookTechNote(projectTechNoteId){
			AjaxUtil.request({
				url : 'look_project_techNote.action',
				params : {projectTechNoteId:projectTechNoteId},
				success : function(responseText){
					window.parent.document.getElementById("mainFrame").src="${pageContext.request.contextPath}/jsp/project/project_techNote.jsp?id="+projectTechNoteId;
				},
				failure : function(){
				}
			});
  		};
   		
   		//切换项目下的客户信息表
   		function lookSale(id){
   			AjaxUtil.request({
				url : 'selectProject.action',
				params : {id:id},
				success : function(responseText){
					window.parent.document.getElementById("mainFrame").src="${pageContext.request.contextPath}/jsp/project/project_id.jsp?id="+id;
				},
				failure : function(){
				}
			});
   		};	
   		
   		//切换项目下的客户信息表
   		function lookClient(projectClientId){
   			AjaxUtil.request({
				url : 'look_project_client.action',
				params : {projectClientId:projectClientId},
				success : function(responseText){
   					window.parent.document.getElementById("mainFrame").src="${pageContext.request.contextPath}/jsp/project/project_clients.jsp?id="+projectClientId;
				},
				failure : function(){
				}
			});
   		};
  
  		initTableWidget('dArticleList',['S','S',"S",'S','S',false]);
  		
  </script>
  
  
</html>
